package leetcode.code787.CheapestFlightsWithinKStops;

import leetcode.IDebug;
import leetcode.helper.HelpDebug;

public abstract class CheapestFlightsWithinKStops implements IDebug {

	abstract public int findCheapestPrice(int n, int[][] flights, int src, int dst, int k);

	@Override
	public void debug1() {
//		Input: n = 3, flights = [[0,1,100],[1,2,100],[0,2,500]], src = 0, dst = 2, k = 1
//		Output: 200
		int n = 3;
		String temp = "[[0,1,100],[1,2,100],[0,2,500]]";
		int[][] flights = HelpDebug.str2array1(temp);
		int src = 0;
		int dst = 2;
		int k = 1;
		int output = 200;
		int result = this.findCheapestPrice(n, flights, src, dst, k);
//		HelpDebug.printInputs(output, new Object[] { n, flights, src, dst, k });
		HelpDebug.printObject((result == output) + ">>" + result);
	}

	@Override
	public void debug2() {
		int n = 3;
		String temp = "[[0,1,100],[1,2,100],[0,2,500]]";
		int[][] flights = HelpDebug.str2array1(temp);
		int src = 0;
		int dst = 2;
		int k = 0;
		int output = 500;
		int result = this.findCheapestPrice(n, flights, src, dst, k);
//		HelpDebug.printInputs(output, new Object[] { n, flights, src, dst, k });
		HelpDebug.printObject((result == output) + ">>" + result);
	}

	@Override
	public void debug3() {
//		5
//		[[4,1,1],[1,2,3],[0,3,2],[0,4,10],[3,1,1],[1,4,3]]
//		2
//		1
//		1
		int n = 5;
		String temp = "[[4,1,1],[1,2,3],[0,3,2],[0,4,10],[3,1,1],[1,4,3]]";
		int[][] flights = HelpDebug.str2array1(temp);
		int src = 2;
		int dst = 1;
		int k = 1;
		int output = -1;
		int result = this.findCheapestPrice(n, flights, src, dst, k);
//		HelpDebug.printInputs(output, new Object[] { n, flights, src, dst, k });
		HelpDebug.printObject((result == output) + ">>" + result);

	}

	@Override
	public void debug4() {
		int n = 5;
		String temp = "[[0,1,5],[1,2,5],[0,3,2],[3,1,2],[1,4,1],[4,2,1]]";
		int[][] flights = HelpDebug.str2array1(temp);
		int src = 0;
		int dst = 2;
		int k = 2;
		int output = 7;
		int result = this.findCheapestPrice(n, flights, src, dst, k);
//		HelpDebug.printInputs(output, new Object[] { n, flights, src, dst, k });
		HelpDebug.printObject((result == output) + ">>" + result);
	}

	public void debug5() {
		int n = 10;
		String temp = "[[0,1,20],[1,2,20],[2,3,30],[3,4,30],[4,5,30],[5,6,30],[6,7,30],[7,8,30],[8,9,30],[0,2,9999],[2,4,9998],[4,7,9997]]";
		int[][] flights = HelpDebug.str2array1(temp);
		int src = 0;
		int dst = 9;
		int k = 4;
		int output = 30054;
		int result = this.findCheapestPrice(n, flights, src, dst, k);
//		HelpDebug.printInputs(output, new Object[] { n, flights, src, dst, k });
		HelpDebug.printObject((result == output) + ">>" + result);
	}

	public void debug6() {
		int n = 2;
		String temp = "[[0,1,2]]";
		int[][] flights = HelpDebug.str2array1(temp);
		int src = 1;
		int dst = 0;
		int k = 0;
		int output = -1;
		int result = this.findCheapestPrice(n, flights, src, dst, k);
//		HelpDebug.printInputs(output, new Object[] { n, flights, src, dst, k });
		HelpDebug.printObject((result == output) + ">>" + result);
	}

	public void debug7() {
//		3
//		[[0,1,2],[1,2,1],[2,0,10]]
//		1
//		2
//		1
		int n = 3;
		String temp = "[[0,1,2],[1,2,1],[2,0,10]]";
		int[][] flights = HelpDebug.str2array1(temp);
		int src = 1;
		int dst = 2;
		int k = 1;
		int output = 1;
		int result = this.findCheapestPrice(n, flights, src, dst, k);
//		HelpDebug.printInputs(output, new Object[] { n, flights, src, dst, k });
		HelpDebug.printObject((result == output) + ">>" + result);
	}

}
